# -*- coding: utf-8 -*-

'''
* 列表 List 只能是数字下标的数组,可变动
'''
List = [ 1, 2, 3, 4 ];
List.insert( 2, 'Paul' );
List.append( u'私奔Abo_o' );

print( u'组合列表:', List + List );
print( u'切片:', List[ 0:6 ] );
print( u'长度:', len( List ) );

# List.pop( -1 );
List.remove( 1 );
print( u'删除:', List );

List.clear();
print( u'清除列表:', List, "\r\n" );


'''
* 元组 Tuple  一旦创建不可修改
'''
Tuple = ( 'runoob', 786 , 2.23, 'john', 70.2 )

print( u'访问元组', Tuple[ 0 ] );
print( u'切片', Tuple[ 1: ] );
print( u'步程未2切片', Tuple[ ::2 ] );

print( u'长度:', len( Tuple ) );
print( u'2.23 是否存在 Tuple:', 2.23 in Tuple, "\r\n" );
# print( u'Tuple 最大值', max( Tuple ) );

'''
*字典 Dict 无序,key不能重复
'''
Dict = {'name': 'john','code':6734, 'dept': 'sales'};

Dict[ 'abo' ] = u'私奔Abo_o';
print( u'访问:', Dict.get( 'abo' ) );

print( u'所有 keys:', Dict.keys() );
print( u'所有 vals:', Dict.values() );
print( u'列表[ 元组 ]返回所有键值', Dict.items() )


# 遍历
for key in Dict:
    print( key, ':', Dict[ key ] );



'''
* 集合 Set 无序,只保证value不会重复
'''
Set = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
print( ('Adam', 95) in Set ); #True

for x in Set:
    print( x, "=>", x[0], ':', x[1] );